package ECMap

import (
	"git.oschina.net/yangdao/extlib"

	"git.oschina.net/yangdao/SGLisp"
	"git.oschina.net/yangdao/extlib/data_type"
)

var ECMaps map[int]*GameMap
var ECMapUnits data_type.IAssociative

func Load(parentPath string) {
	ECMaps = make(map[int]*GameMap)

	maps := SGLisp.EvalValueFormFile(parentPath+"Maps.clj", SGLisp.MainContext)
	extlib.ForEach(maps.(data_type.ISequence), func(kv interface{}) {
		id := kv.(data_type.IIndexed).Nth(0).(int)
		data := kv.(data_type.IIndexed).Nth(1).(data_type.IAssociative)
		ECMaps[id] = ECMap_DeCode(parentPath + data.Get(":path").(string))

	})

	ECMapUnits = SGLisp.EvalValueFormFile(parentPath+"MapUnitItem.clj", SGLisp.MainContext).(data_type.IAssociative)

}
